﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ScarfMaker
{
    /// <summary>
    /// MenuWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MenuWindow : Window
    {
        public MenuWindow()
        {
            InitializeComponent();
            this.Hide();
            Login l = new Login();
            if (l.ShowDialog() == true)
            {
                this.Show();
            }
            else
            {
                this.Close();
            }
        }
        void OpenWindow(Window win)
        {
            this.Hide();
            win.ShowDialog() ;
            if(Models.StaticClass.WaitForOpen!=null)
            {
                Models.StaticClass.WaitForOpen.ShowDialog();
                Models.StaticClass.WaitForOpen = null;
            }
            try
            {
                this.Show();
            }catch(Exception ex)
            {

            }
        }
        private void btnMainWindow_Click(object sender, RoutedEventArgs e)
        {
            OpenWindow(new ScarfWindow());
        }

        private void btnPicWindow_Click(object sender, RoutedEventArgs e)
        {
            OpenWindow(new MaterialView());
        }

        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown(0);
        }
    }
}
